package com.example.demo.controller;

import com.example.demo.dao.RoleDao;
import com.example.demo.domain.Role;
import com.example.demo.service.Impl.RoleImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("role")
public class RoleController {
    @Autowired
    private RoleImpl role;

    @GetMapping("{id}")
    public Role getbyid(@PathVariable Integer id){
        return role.getById(id);
    }
    @GetMapping
    public List<Role> getAll(){
        return role.list();
    }
}
